/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entityBeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author allankv
 */
@Entity
@Table(name = "individual")
@NamedQueries({
    @NamedQuery(name = "Individual.findAll", query = "SELECT i FROM Individual i"),
    @NamedQuery(name = "Individual.findByIdindividual", query = "SELECT i FROM Individual i WHERE i.idindividual = :idindividual"),
    @NamedQuery(name = "Individual.findByIndividual", query = "SELECT i FROM Individual i WHERE i.individual = :individual")})
public class Individual implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idindividual")
    private Integer idindividual;
    @Basic(optional = false)
    @Column(name = "individual")
    private String individual;
    @JoinTable(name = "occurrenceindividual", joinColumns = {
        @JoinColumn(name = "idindividual", referencedColumnName = "idindividual")}, inverseJoinColumns = {
        @JoinColumn(name = "idoccurrenceelement", referencedColumnName = "idoccurrenceelement")})
    @ManyToMany(fetch = FetchType.LAZY)
    private List<Occurrenceelement> occurrenceelementList;

    public Individual() {
    }

    public Individual(Integer idindividual) {
        this.idindividual = idindividual;
    }

    public Individual(Integer idindividual, String individual) {
        this.idindividual = idindividual;
        this.individual = individual;
    }

    public Integer getIdindividual() {
        return idindividual;
    }

    public void setIdindividual(Integer idindividual) {
        this.idindividual = idindividual;
    }

    public String getIndividual() {
        return individual;
    }

    public void setIndividual(String individual) {
        this.individual = individual;
    }

    public List<Occurrenceelement> getOccurrenceelementList() {
        return occurrenceelementList;
    }

    public void setOccurrenceelementList(List<Occurrenceelement> occurrenceelementList) {
        this.occurrenceelementList = occurrenceelementList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idindividual != null ? idindividual.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Individual)) {
            return false;
        }
        Individual other = (Individual) object;
        if ((this.idindividual == null && other.idindividual != null) || (this.idindividual != null && !this.idindividual.equals(other.idindividual))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityBeans.Individual[idindividual=" + idindividual + "]";
    }

}
